import tensorflow as tf
from keras.layers import Concatenate, Input, Lambda, UpSampling2D
from keras.models import Model
from tensorflow._api.v1 import dtypes
from utils.utils import compose


img = tf.constant(value=[[[[1],[2],[3],[4]],[[1],[2],[3],[4]],[[1],[2],[3],[4]],[[1],[2],[3],[4]]]],dtype=tf.float32)
print(img.shape)
with tf.Session() as sess:
    print(img.eval())
img = tf.concat(values=[img,img],axis=3)

print(img.shape)
with tf.Session() as sess:
    print(img.eval())

#用3*3的卷积核卷积 padding='VALID'
filter = tf.constant(value=1,shape=[3,3,2,5],dtype=tf.float32)
with tf.Session() as sess:
    print(filter.eval())

out_img = tf.nn.conv2d(input=img,filter=filter,strides=[1,1,1,1],padding='VALID')
print(out_img.shape)
with tf.Session() as sess:
    print(out_img.eval())

#用3*3的卷积核卷积 padding='SAME'
out_img = tf.nn.conv2d(input=img,filter=filter,strides=[1,1,1,1],padding='SAME')
print(out_img.shape)
with tf.Session() as sess:
    print(out_img.eval())

#空洞卷积rate=2
out_img = tf.nn.atrous_conv2d(value=img,filters=filter,rate=3,padding='SAME')
print(out_img.shape)
with tf.Session() as sess:
    print(out_img.eval())